<?php
session_start(); 
error_reporting(7);
require_once '../../includes/global.php';
require_once "../../includes/admins.php";
if($_POST[action]=="insert")
{
		$_POST[adddate]=time();
		$_POST[$_POST[cpzd]]=htmlspecialchars( stripslashes($_POST[body]));
		$_POST[userid]=$_SESSION[userinfo][username];
		//print_r($_POST);
		//exit;
		inserts("info",$_POST);
		$lastid=mysql_insert_id();
		?>
		<script language="javascript">
		parent.main.document.getElementById("id").value=<?php echo $lastid?>;
		parent.main.document.getElementById("action").value="modify";
		alert("update OK");
		parent.dismissbox();
		</script>
		<?php

}
if($_POST[action]=="modify")
{   
  	  $arr[$_POST[cpzd]]=htmlspecialchars( stripslashes($_POST[body]));
		updates('info',$arr,'id',$_POST[id]);
		?>
		<script language="javascript">
		alert("update OK");
		parent.dismissbox();
		</script>
		<?php
}

if($_GET[action]=='insert'&&$_GET[id]=='')
{
$date=date("Y年m月d日 h时i分");
$info="<BR><HR align=center width=100% color=#2f468f noShade SIZE=1><DIV align=center>发布时间：".$date."</DIV><P><br>请输入内容内容(支持图文混排)</P>";
}
else
{
 $temp=fetchaline('info',"id='".$_GET[id]."'");
 $info=$temp[$_GET[cpzd]];
}
?><HTML><HEAD><TITLE>参数设置</TITLE><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css"  href="../../includes/css/new1.css" rel="stylesheet" >
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></HEAD>
<BODY >
<body  class="NormalPage">
<form>
<input type="hidden" name="newsContent" value="<?php echo $info;?>">
</form>
<form action="" method="post" enctype="multipart/form-data" name="form1">
                <input  name=body type=hidden>
<input type='hidden' name="sortid" value="<?php echo $_GET[sortid];?>">
  <input  type='hidden' name="id" value="<?php echo $_GET[id];?>">
  <input  type='hidden' name="cpzd" value="<?php echo $_GET[cpzd];?>">
  <input  type='hidden' name="action" value="<?php echo $_GET[action];?>">
<script language="javascript" src="../../includes/ubb/zoom.js"></script>
  <input type="submit" name="Submit"   onClick="save();" value="提交">
  </label>
</form>
</body>
</html>